package cn.gson.springmvc.model.pojos;

import javax.persistence.*;
import java.math.BigDecimal;
import java.sql.Date;
import java.util.Collection;
import java.util.Objects;

@Entity
public class Veg {
    private int vegId;
    private String vegType;
    private BigDecimal vegFee;
    private String vegFeeType;
    private String vegDept;
    private Date vegDate;
    private Date appointmentTime;
    private String patientName11;
    private String vegState;
    private Collection<Ordered> orderedsByVegId;
    private Collection<Payment> paymentsByVegId;
    private Collection<User> usersByVegId;
    private Medical medicalByMedicalId;
    private Patient patientByPatientId;

    @Id
    @Column(name = "veg_id", nullable = false)
    public int getVegId() {
        return vegId;
    }

    public void setVegId(int vegId) {
        this.vegId = vegId;
    }

    @Basic
    @Column(name = "veg_type", nullable = true, length = 10)
    public String getVegType() {
        return vegType;
    }

    public void setVegType(String vegType) {
        this.vegType = vegType;
    }

    @Basic
    @Column(name = "veg_fee", nullable = true, precision = 2)
    public BigDecimal getVegFee() {
        return vegFee;
    }

    public void setVegFee(BigDecimal vegFee) {
        this.vegFee = vegFee;
    }

    @Basic
    @Column(name = "veg_fee_type", nullable = true, length = 10)
    public String getVegFeeType() {
        return vegFeeType;
    }

    public void setVegFeeType(String vegFeeType) {
        this.vegFeeType = vegFeeType;
    }

    @Basic
    @Column(name = "veg_dept", nullable = true, length = 10)
    public String getVegDept() {
        return vegDept;
    }

    public void setVegDept(String vegDept) {
        this.vegDept = vegDept;
    }

    @Basic
    @Column(name = "veg_date", nullable = true)
    public Date getVegDate() {
        return vegDate;
    }

    public void setVegDate(Date vegDate) {
        this.vegDate = vegDate;
    }

    @Basic
    @Column(name = "appointment_time", nullable = true)
    public Date getAppointmentTime() {
        return appointmentTime;
    }

    public void setAppointmentTime(Date appointmentTime) {
        this.appointmentTime = appointmentTime;
    }

    @Basic
    @Column(name = "patient_name11", nullable = true, length = 50)
    public String getPatientName11() {
        return patientName11;
    }

    public void setPatientName11(String patientName11) {
        this.patientName11 = patientName11;
    }

    @Basic
    @Column(name = "veg_state", nullable = true, length = 10)
    public String getVegState() {
        return vegState;
    }

    public void setVegState(String vegState) {
        this.vegState = vegState;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Veg veg = (Veg) o;
        return vegId == veg.vegId &&
                Objects.equals(vegType, veg.vegType) &&
                Objects.equals(vegFee, veg.vegFee) &&
                Objects.equals(vegFeeType, veg.vegFeeType) &&
                Objects.equals(vegDept, veg.vegDept) &&
                Objects.equals(vegDate, veg.vegDate) &&
                Objects.equals(appointmentTime, veg.appointmentTime) &&
                Objects.equals(patientName11, veg.patientName11) &&
                Objects.equals(vegState, veg.vegState);
    }

    @Override
    public int hashCode() {
        return Objects.hash(vegId, vegType, vegFee, vegFeeType, vegDept, vegDate, appointmentTime, patientName11, vegState);
    }

    @OneToMany(mappedBy = "vegByVegId")
    public Collection<Ordered> getOrderedsByVegId() {
        return orderedsByVegId;
    }

    public void setOrderedsByVegId(Collection<Ordered> orderedsByVegId) {
        this.orderedsByVegId = orderedsByVegId;
    }

    @OneToMany(mappedBy = "vegByVegId")
    public Collection<Payment> getPaymentsByVegId() {
        return paymentsByVegId;
    }

    public void setPaymentsByVegId(Collection<Payment> paymentsByVegId) {
        this.paymentsByVegId = paymentsByVegId;
    }

    @OneToMany(mappedBy = "vegByVegId")
    public Collection<User> getUsersByVegId() {
        return usersByVegId;
    }

    public void setUsersByVegId(Collection<User> usersByVegId) {
        this.usersByVegId = usersByVegId;
    }

    @ManyToOne
    @JoinColumn(name = "medical_id", referencedColumnName = "medical_id")
    public Medical getMedicalByMedicalId() {
        return medicalByMedicalId;
    }

    public void setMedicalByMedicalId(Medical medicalByMedicalId) {
        this.medicalByMedicalId = medicalByMedicalId;
    }

    @ManyToOne
    @JoinColumn(name = "patient_id", referencedColumnName = "patient_id")
    public Patient getPatientByPatientId() {
        return patientByPatientId;
    }

    public void setPatientByPatientId(Patient patientByPatientId) {
        this.patientByPatientId = patientByPatientId;
    }
}
